package com.modules.config;

import com.modules.properties.LicenseProperties;
import com.modules.entity.LicenseVerifyParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(LicenseProperties.class)
public class LicenseConfiguration {
    @Autowired
    private LicenseProperties licenseProperties;

    @Bean
    public LicenseVerifyParam install() {
        LicenseVerifyParam param = new LicenseVerifyParam();
        param.setSubject(licenseProperties.getSubject());
        param.setPublicAlias(licenseProperties.getPublicAlias());
        param.setStorePass(licenseProperties.getStorePass());
        param.setLicensePath(licenseProperties.getLicensePath());
        param.setPublicKeysStorePath(licenseProperties.getPublicKeysStorePath());
        return param;
    }
}
